import request from '@/util/request'
import { dealOpts, INVENT, firm_inventory } from './../api_type'

// 进货单
const inventCreateBill = (params, opts) => {
  return request.post(dealOpts(INVENT + '/createBuyingBill', opts), params)
}

const inventGetSalesBills = (params, opts) => {
  return request.post(dealOpts(INVENT + '/getBuyingBills', opts), params)
}

const inventGetBuyingBillInfo = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getBuyingBillInfo', opts), params)
}

const inventModifyBill = (params, opts) => {
  return request.post(dealOpts(INVENT + '/modifyBuyingBill', opts), params)
}

const inventDeleteSalesBill = (params, opts) => {
  return request.post(dealOpts(INVENT + '/deleteBuyingBill', opts), params)
}

// 销售单
const inventGetSellingBills = (params, opts) => {
  return request.post(dealOpts(INVENT + '/getSellingBills', opts), params)
}
const inventDeleteSellingBill = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteSellingBill', opts), params)
}

// 收支
const inventGetBillCosts = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getBillCosts', opts), params)
}

const inventGetBillGoodsCosts = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getBillGoodsCosts', opts), params)
}

const inventAddBillGoodsCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/addBillGoodsCost', opts), params)
}

const inventGetBillGoodsCostInfo = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getBillGoodsCostInfo', opts), params)
}

const inventDeleteBillGoodsCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteBillGoodsCost', opts), params)
}

const inventModifyBillGoodsCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/modifyBillGoodsCost', opts), params)
}

const inventGetCosts = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getCosts', opts), params)
}

const inventCreateCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/createCost', opts), params)
}

const inventModifyCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/modifyCost', opts), params)
}

const inventDeleteCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteCost', opts), params)
}

const inventSetCostClass = (params, opts) => {
  return request.get(dealOpts(INVENT + '/setCostClass', opts), params)
}

const inventGetCostClasses = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getCostClasses', opts), params)
}

const inventDeleteCostClass = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteCostClass', opts), params)
}

const inventSetCostGoods = (params, opts) => {
  return request.get(dealOpts(INVENT + '/setCostGoods', opts), params)
}

const inventGetCostGoodses = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getCostGoodses', opts), params)
}

const inventDeleteCostGoods = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteCostGoods', opts), params)
}

const inventDeleteBillCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteBillCost', opts), params)
}

const inventAddBillCost = (params, opts) => {
  return request.get(dealOpts(INVENT + '/addBillCost', opts), params)
}

const firm_inventory_setBuyingBillSku = (params, opts) => {
  return request.post(dealOpts(firm_inventory + '/setBillSku', opts), params)
}

const invent_deleteBillSku = (params, opts) => {
  return request.get(dealOpts(INVENT + '/deleteBillSku', opts), params)
}

// 销售详情
const invent_getSellingBillInfo = (params, opts) => {
  return request.get(dealOpts(INVENT + '/getSellingBillInfo', opts), params)
}

const invent_createSellingBill = (params, opts) => {
  return request.post(dealOpts(INVENT + '/createSellingBill', opts), params)
}

const invent_modifySellingBill = (params, opts) => {
  return request.post(dealOpts(INVENT + '/modifySellingBill', opts), params)
}

const invent_impXls2Bill = (params, opts) => {
  return request.formData(dealOpts(INVENT + '/impXls2Bill', opts), params)
}

export default {
  inventCreateBill,
  inventGetSalesBills,
  inventGetBuyingBillInfo,
  inventModifyBill,
  inventDeleteSalesBill,
  inventGetBillCosts,
  inventGetBillGoodsCosts,
  inventAddBillGoodsCost,
  inventGetBillGoodsCostInfo,
  inventDeleteBillGoodsCost,
  inventGetCosts,
  inventCreateCost,
  inventModifyCost,
  inventDeleteCost,
  inventSetCostClass,
  inventGetCostClasses,
  inventDeleteCostClass,
  inventGetSellingBills,
  inventDeleteSellingBill,
  inventModifyBillGoodsCost,
  inventSetCostGoods,
  inventGetCostGoodses,
  inventDeleteCostGoods,
  inventDeleteBillCost,
  inventAddBillCost,
  firm_inventory_setBuyingBillSku,
  invent_deleteBillSku,
  invent_getSellingBillInfo,
  invent_impXls2Bill,
  invent_createSellingBill,
  invent_modifySellingBill
}
